package com.taplinker.client.im.domain;

import com.taplinker.client.R;

public enum EnumConversationSource {
	WEB(0, "WEB", "网站咨询", R.drawable.consulting_from_type_web, R.drawable.consulting_from_type_web_min),
	APP(1, "APP", "App咨询", R.drawable.consulting_from_type_app, R.drawable.consulting_from_type_app_min),
	QR(2, "QR", "QR码咨询", R.drawable.consulting_from_type_qr, R.drawable.consulting_from_type_qr_min),
	EMAIL(3, "MAIL", "邮件咨询", R.drawable.consulting_from_type_qr, R.drawable.consulting_from_type_qr_min),
	WECHAT(4, "WECHAT", "微信账号", R.drawable.consulting_from_type_qr, R.drawable.consulting_from_type_qr_min),
	SINA_WEIBO(5, "SINAWEIBO", "新浪微博", R.drawable.consulting_from_type_qr, R.drawable.consulting_from_type_qr_min),
	TENCENT_WEIBO(6, "TENCENTWEIBO", "腾讯微博", R.drawable.consulting_from_type_qr, R.drawable.consulting_from_type_qr_min),
	UNKNOW(7, "UNKNOW", "未知来源", R.drawable.consulting_from_type_app, R.drawable.consulting_from_type_app_min);

	private int no;
	private String code;
	private String description;
	private int iconResId;
	private int iconMinResId;

	EnumConversationSource(int no, String code, String description, int iconResId, int iconMinResId) {
		this.no = no;
		this.code = code;
		this.description = description;
		this.iconResId = iconResId;
		this.iconMinResId = iconMinResId;
	}

	public int getNo() {
		return no;
	}

	public void setNo(int no) {
		this.no = no;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public int getIconResId() {
		return iconResId;
	}

	public void setIconResId(int iconResId) {
		this.iconResId = iconResId;
	}

	public int getIconMinResId() {
		return iconMinResId;
	}

	public void setIconMinResId(int iconMinResId) {
		this.iconMinResId = iconMinResId;
	}

	public static EnumConversationSource getByCode(String code) {
		if (WEB.getCode().equalsIgnoreCase(code)) {
			return WEB;
		} else if (APP.getCode().equalsIgnoreCase(code)) {
			return APP;
		} else if (QR.getCode().equalsIgnoreCase(code)) {
			return QR;
		} else if (EMAIL.getCode().equalsIgnoreCase(code)) {
			return EMAIL;
		} else if (WECHAT.getCode().equalsIgnoreCase(code)) {
			return WECHAT;
		} else if (SINA_WEIBO.getCode().equalsIgnoreCase(code)) {
			return SINA_WEIBO;
		} else if (TENCENT_WEIBO.getCode().equalsIgnoreCase(code)) {
			return TENCENT_WEIBO;
		} else {
			return UNKNOW;
		}
	}

	public boolean equals(EnumConversationSource src) {
		if (src == null) {
			return false;
		}
		if (getNo() == src.getNo()) {
			return true;
		} else {
			return false;
		}
	}

}
